<template>
  <img alt="Vue logo" src="./assets/logo.png" />
  <h1>一个人的信息</h1>
  <h2>a的值是：{{ count }}</h2>
  <button @click="count++">+</button>
  <button @click="count--">-</button>
</template>

<script>
import { ref } from 'vue';

export default {
  setup() {
    //响应式的数据使用ref
    const count = ref(0);
    let counts = 0;

    // 返回值会暴露给模板和其他的选项式 API 钩子
    console.log(this);

    function printThis() {
      console.log(this);
    }

    return {
      count,
      counts,
    };

  },

  mounted() {
    console.log(this.count); // 0
    console.log(this); 
  },
};
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
